package thread;

public class Thread3 {
    public static void main(String[] args) {
        try {
            MyThread myThread=new MyThread();
            myThread.start();
            Thread.sleep(1000);
            myThread.interrupt();
            System.out.println("是否停止1?="+myThread.interrupted());
            System.out.println("是否停止2?="+myThread.interrupted());
        } catch (InterruptedException e) {
            System.out.println("main catch");
            e.printStackTrace();
        }
        System.out.println("end");
    }
}

class MyThread extends Thread{
    @Override
    public void run() {
        for(int i=0;i<500000;i++){
            System.out.println("i="+i);
        }
    }
}
